/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package prototype.communication;

import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import prototype.persistence.pojo.Scenario;


/**
 *
 * @author Server
 */
public class Message implements Serializable {

    public final static int JOIN = 1;
    public final static int JOIN_RES = 2;
    public final static int QUIT = 3;
    public final static int KICK = 4;
    public final static int READY = 5;
    public final static int NOT_READY = 6;
    public final static int ARE_YOU_ALIVE = 7;
    public final static int I_AM_ALIVE = 8;
    public final static int REFRESH_RES = 9;
    public final static int REFRESH_REQ = 10;
    public final static int MAP_REQ = 11;
    public final static int MAP_RES = 12;
    public final static int SIM_START = 13;
    private int messageType;
    private int destinationUserIndex;
    private String messageText;
    private Scenario scenario;

    public Message(int messageType) {
        this.messageType = messageType;
    }

    public int getMessageType() {
        return messageType;
    }

    public String getMessageText() {
        return messageText;
    }

    public void setMessageText(String messageText) {
        this.messageText = messageText;
    }

    public void serialize(OutputStream os) {
        try {
            (new ObjectOutputStream(os)).writeObject(this);
            os.flush();
        } catch (IOException ex) {
            Logger.getLogger(Message.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void setScenario(Scenario scenario) {
        this.scenario = scenario;
    }

    public Scenario getScenario() {
        return scenario;
    }

    public int getDestinationUserIndex() {
        return destinationUserIndex;
    }

    public void setDestinationUserIndex(int destinationUserIndex) {
        this.destinationUserIndex = destinationUserIndex;
    }
}
